#include<iostream>
using namespace std;
const int N = 5e5 + 10;
int arr[N];
int n;
int main()
{
	cin >> n;
	int len = 1;
	arr[0] = 1;
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		int t = 0;
		for (int j = 0; j < len; j++) {
			t = arr[j] * i + sum;
			arr[j] = t % 10;
			sum = t / 10;
		}
		while (sum) {
			arr[len++] = sum % 10;
			sum /= 10;
		}
	}
	/*for (int i = len - 1; i >= 0; i--) {
		cout << arr[i];
	}*/
	for (int i = 0; i < len; i++) {
		if (arr[i]) {
			cout << arr[i] << endl;
			break;
		}
	}
	return 0;
}